# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgbase=phonon-vlc
pkgname=('phonon-qt4-vlc' 'phonon-qt5-vlc')
pkgver=0.9.1
pkgrel=2
arch=('i686' 'x86_64')
url='http://phonon.kde.org/'
license=('LGPL')
makedepends=('vlc' 'extra-cmake-modules' 'automoc4' 'phonon-qt4' 'phonon-qt5')
source=("http://download.kde.org/stable/phonon/phonon-backend-vlc/${pkgver}/phonon-backend-vlc-${pkgver}.tar.xz"{,.sig})
sha256sums=('e698729ba8487299105309623722344f2cd84c46482516d51cd6609fac297313'
            'SKIP')
validpgpkeys=(CB9387521E1EE0127DA804843FDBB55084CC5D84) # Harald Sitter <sitter@kde.org>

prepare() {
  mkdir build-qt4
  mkdir build-qt5
}

build() {
  cd build-qt4
  cmake ../phonon-backend-vlc-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_SKIP_RPATH=ON \
    -D__KDE_HAVE_GCC_VISIBILITY=NO \
    -DPLUGIN_INSTALL_DIR=/usr/lib/kde4
  make

  cd ../build-qt5
  cmake ../phonon-backend-vlc-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_SKIP_RPATH=ON \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -D__KDE_HAVE_GCC_VISIBILITY=NO \
    -DPHONON_BUILD_PHONON4QT5=ON
  make
}

package_phonon-qt4-vlc() {
  pkgdesc="Phonon VLC backend for Qt4"
  depends=('vlc' 'phonon-qt4')
  provides=('phonon-qt4-backend')

  cd build-qt4
  make DESTDIR="${pkgdir}" install
}

package_phonon-qt5-vlc() {
  pkgdesc="Phonon VLC backend for Qt5"
  depends=('vlc' 'phonon-qt5')
  provides=('phonon-qt5-backend')

  cd build-qt5
  make DESTDIR="${pkgdir}" install
}
